IApi.AddVariable method
Adds a user-defined variable.
Namespace: IntervalZero.KINGSTAR.Base.ApiAssembly: IntervalZero.KINGSTAR.Base.Api (in IntervalZero.KINGSTAR.Base.dll) Version: 4.4.0.0
Syntax
KsReturn<UserVariable> AddVariable(
string Name,
KsLogDataType Type,
UserVariable Parent = null,
long FolderSize = 0
)
Function AddVariable(
Name As String,
Type As KsLogDataType,
Parent = null As UserVariable,
Long As FolderSize = 0
) As KsReturn(Of UserVariable)
Parameters
Name
Type: string
The name of a variable.
Type
Type: KsLogDataType
The data type of a variable.
Parent
Type: UserVariable
Default value: null
The parent folder of UserVariable. By default, it adds variables to the root folder.
FolderSize
Type: long
Default value: 0
The FolderSize is used when logDirectory variable is added. By default, you can add up to 64 UserVariable.
- When Parent is set as null, the UserVariable will be added to the default directory, which is the root folder. In such case, the space of the root folder can store up to 64 UserVariable and cannot be changed.
- When Parent is not set as null, the UserVariable will be added to the specified directory. In such case, you can configure the FolderSize of the directory.
- FolderSize = 0, the space of the directory will be applied with the default value, which can store up to 64 UserVariable.
- FolderSize ≠ 0, the space of the directory will be applied with the specified value.
Return value
Type: KsReturn<UserVariable>
Returns a KsError code and a user-defined variable.
Remarks
- The Name string uses UTF-16 encoding.
- You can add up to 64 variables to the root folder.
- The variable can be used in KINGSTAR Scope and a real-time log.
Usable EtherCAT states
ecatOffline, ecatInit, ecatBoot, ecatPreOP, ecatSafeOP, ecatOP
Examples
N/A
See also